/**
 * Created by YJH on 2018/5/25.
 */
/**
 * Created by YJH on 2018/5/25.
 */

import React, {Component, PropStyles} from 'react';
import {
    View,
    Image,
    Text,
    StyleSheet,
    Button,
    TextInput,
} from 'react-native';

export default class BaiduPage extends Component<Props> {
    constructor(props) {
        super(props);
    }

    render() {
        const {navigation} = this.props;
        const {state, setParams} = navigation;
        const {params}=state;
        const showText=params.mode==='input'?'正在输入中...':'输入完成';
        return (
            <View style={styles.container}>
                <Text style={styles.text}>欢迎来到度娘总部</Text>

                <Button style={styles.button} title='点击回到上一页' onPress={() => {
                    navigation.goBack()
                }}/>

                <TextInput
                    style={styles.edt}
                    onChangeText={text=>{
                        setParams({title: text})
                    }}
                />
                <Text style={styles.text}>{showText}</Text>
            </View>
        )
    }
}


const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#FBFBFF',
        justifyContent: 'center'
    },
    text: {
        fontSize: 20,
        marginTop: 10,
        alignSelf: 'center',
    },
    button: {
        height: 50,
        marginTop: 30,
        alignSelf: 'center',
    },
    edt: {
        height: 50,
        marginTop: 30,
        minWidth: 300,
        alignSelf: 'center',
        borderColor: '#02F78E',
    },

})
